
public class NewThread extends Thread {
	NewThread() {
		// Create a new, second thread
		super("Demo Thread");
		System.out.println("Child thread: "+this);
		start();
	}
	
	// This is the entry point for the second thread.
	public void run() {
		try {
			for(int i = 5; i > 0; i--) {
				System.out.println("Child Thread " + i);
				Thread.sleep(50);
				}
		}catch(InterruptedException e){
			System.out.println("Child interrupted.");
		}
		System.out.println("Exiting child thread.");
	}
}
